﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using LibCommon;
using RTCCore;

namespace LibRTC.Core.MessageMap.PresenceStatusEvent
{
    public class PresenceStatusHandler : SimpleMessageHandler
    {
        private static ILogger LOGGER = LoggerFactory.GetLogger("PresenceStatusHandler", null);

        public PresenceStatusHandler() {
            _rtcEvent = RTC_EVENT.RTCE_PRESENCE_STATUS;
            _name = "PresenceStatusHandler";
        }

        public override void Process(RTC_EVENT rtcEventType, object rtcEvent)
        {
            Debug.Assert(RTC_EVENT.RTCE_PRESENCE_STATUS == rtcEventType);
            Debug.Assert(null != rtcEvent);
            Debug.Assert(rtcEvent is IRTCPresenceStatusEvent);

            IRTCPresenceStatusEvent statusEvent = rtcEvent as IRTCPresenceStatusEvent;
            Debug.Assert(null != statusEvent);

            RTC_PRESENCE_STATUS status;
            string note;

            statusEvent.GetLocalPresenceInfo(out status,out note);

            LOGGER.LogInfo("Current Status : "+status+", note : "+note);

        }
    }
}
